home *** CD-ROM | disk | FTP | other *** search
- Path: news.pi.net!news
- From: heggie <heggie@pi.net>
- Newsgroups: comp.lang.c++
- Subject: SORTing problem c++
- Date: Sat, 27 Jan 1996 21:46:56 -0800
- Organization: heggie
- Message-ID: <310B0DD0.34F1@pi.net>
- NNTP-Posting-Host: gro40.pi.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b5 (Win16; I)
-
- I'm used to normal c
- just recent i switched to c++, now i am stucked
- with a program that did work in c but doesn't
- in c++.
- it is a program that sorts the 'argv'command line
- arguments array,
-
- what can I DO???
- p.s. I am using borlands c++
- p.s. thanks for reading this
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-
-
- int sort_function(char **a, char **b)
- {
- return( strcmp(*a, *b));
- }
-
-
- int main(int argc, char **argv)
- {
- int
- x;
-
- qsort(argv, argc, sizeof(char*), sort_function);
-
- for (x = 0; x < argc; x++)
- printf("%s\n", argv[x]);
- return 0;
- }
-
- ******************************************
- these are the error mesages,
-
-
- Error ..\SOURCES\OPDR_45.CPP 17: Cannot convert 'int (*)(char * *,char *
- *)' to 'int (*)(const void *,const void *)'
- Error ..\SOURCES\OPDR_45.CPP 17: Type mismatch in parameter '__fcmp' in
- call to 'qsort(void *,unsigned int,unsigned int,int (*)(const void
- *,const void *))'
-
- >
-